home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / comm / prtcs155.zip / CHAT.WPL < prev    next >
Text File  |  1994-01-14  |  3KB  |  134 lines

  1. /**/ 
  2. v="$VER: Chat Wplrx  User WPL Chat Utility                Williamson 54.06"
  3. /*
  4.  RexxMSG "" REXX "MAIL:rexx/Chat $(baud) $(line) $(username)"
  5. */
  6. mailer=GetClip('SHELTER')
  7. options RESULTS
  8. options failat 99
  9. signal on syntax
  10. signal on halt
  11. signal on ioerr
  12. signal on break_c
  13. signal on break_d
  14. 'String $(chatmode)'
  15. if upper(RESULT)="SYSOP" then forced=1
  16. else forced=0
  17. cr='\r\n'
  18. nl='0a'x
  19. bs='08'x
  20. quote = '"'
  21. l_mailer=lower(mailer)
  22. parse arg baud port username
  23. if forced then do
  24.     call send(cr||'The sysop is coming online'||cr)
  25. end;else do
  26.     if username = "" then do
  27.         fname=wpl_prompt(60,cr||' Please enter your name: ')
  28.         if fname="" then do
  29.             call send(cr||'Sorry, your name is required in order to chat with sysop'||cr)
  30.             call send(cr||'If you wish, you can leave a message with NOTE'||cr)
  31.             call cleanup()
  32.             exit 0
  33.         end
  34.     end
  35.     else fname=strip(username)
  36.     call logname(fname)
  37.     'Set fname' fname
  38.     call send(cr||'Paging sysop....hit Q<cr> to quit'||cr)
  39.     speech=fname' wants to talk.'
  40.     cmd = 'Say' '"'speech'"'
  41.     address COMMAND cmd
  42.  
  43.     do i=0 to 200
  44.         call writech(STDOUT,"."||'07'x)
  45.         x=nprompt(1,"."||'07'x)
  46.         if index(upper(x),'Q')>0 then break
  47.         call delay(60)
  48.         'CheckCarrier'
  49.         if RC~=0 then do
  50.             call cleanup
  51.             exit
  52.         end
  53.         'String $(chat)'
  54.         chatstat=RESULT
  55.         if upper(chatstat) = "ONLINE" then leave
  56.     end
  57.     if upper(chatstat) ~= "ONLINE" then do
  58.         call send(cr||'Sorry, the sysop seems to be unavailable'||cr)
  59.         call send(cr||'If you wish, you can leave a message with the NOTE command.'||cr)
  60.         call cleanup
  61.         exit
  62.     end
  63.     resp=wpl_prompt(100,'Sysop online, what is the Subject? ')
  64. end
  65.  
  66. 'String $(chat)'
  67. chatstat=RESULT
  68. do while chatstat="ONLINE"
  69.     'CheckCarrier'
  70.     if RC~=0 then leave
  71.     resp=getstring(300)
  72.     'String $(chat)'
  73.     chatstat=RESULT
  74. end
  75. call cleanup()
  76. exit 0
  77.  
  78.  
  79. logname:
  80. 'String $(p.login)'
  81. namepos=RESULT
  82. Address "LOGPROC" 'PutLine 'l_mailer'wplstat'port namepos arg(1) time()
  83. return
  84.  
  85. send:
  86. 'Print' quote||arg(1)||quote
  87. 'Send' quote||arg(1)||quote
  88. return
  89.  
  90. wpl_prompt:
  91. 'Print' quote||arg(2)||quote
  92. nprompt:
  93. 'Send' quote||arg(2)||quote
  94. getstring:
  95. 'GetInbound E0 'arg(1)
  96. 'String $(event)'
  97. if upper(RESULT) = 'CARRIER' then do
  98.     Address "LOGPROC" 'PutLog 'l_mailer'wpl' left(time(),5) port "CHAT:" fname 'Dropped Carrier'
  99.     call cleanup
  100.     exit
  101. end;else if upper(RESULT) = 'LOGIN' then do
  102.     'String $(namebuf)'
  103.     return (RESULT)
  104. end
  105. x=""
  106. return x
  107.  
  108. lower:
  109. return(bitor(arg(1),'20'x))
  110. cleanup:
  111.     'Clear chat chatmode'
  112. return 0
  113. break_c:
  114. break_d:
  115.     call cleanup
  116.     exit 10
  117. novalue: 
  118. call template_oops "Novalue" sigl
  119. syntax:
  120. call template_oops "Syntax(RC=" || RC || ")" sigl
  121. failure:
  122. call template_oops "Failure(RC=" || RC || ")" sigl
  123. ioerr:
  124. call template_oops "IOErr" sigl 
  125. halt:
  126. call template_oops "Halt" sigl 
  127. template_oops:
  128. parse arg what badline
  129. say 'ERR:'what "Line:"badline
  130. say 'ERR:'strip(sourceline(badline))
  131. call cleanup
  132. exit(40)
  133. /**/
  134.